from optparse import OptionParser
from ai.ali.face import ALIFace
from ai.baidu.imgobj import BaiduDemo

if __name__ == "__main__":
    parser = OptionParser()
    parser.add_option("-t", dest="type")
    parser.add_option("-f", dest="file")

    (options, args) = parser.parse_args()
    print("type is ", options.type, " file is ", options.file)
    if options.type == "ali-fd":
        aliface = ALIFace("ai/keyfile.json")
        aliface.face_detect(options.file)
    elif options.type == "baidu":
        baidu = BaiduDemo("ai/baidu/sec.json")
        # baidu.body_analysis(options.file)
        baidu.body_attr(options.file)

    print("All done")